package com.zj.leetcode.easy.greed;

import java.util.Arrays;

/**
 * @program: algorithm
 * @description: 数组拆分 I
 * 561 array-partition-i
 * @author: Zhang Bo
 * @create: 2022-01-14 17:05
 **/
public class ArrayPartitionI {
    public static void main(String[] args) {
        Solution solution = new ArrayPartitionI().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int arrayPairSum(int[] nums) {
            Arrays.sort(nums);
            int count = 0;
            for (int i = 0; i < nums.length; i = i + 2) {
                count += nums[i];
            }
            return count;

        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}